#include <iostream>
#include <string>

#include "array.h"

using namespace std;

int main() {
	Array<int> array(10);

	cout << array << endl;

	for (ArrayIterator<int> iter = array.begin(); iter != array.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	int a[] = {10, 20, 30, 40, 50};

	array = Array<int>(5, a);

	cout << array << endl;

	for (ArrayIterator<int> iter = array.begin(); iter != array.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	ArrayIterator<int> iter2 = array.end();
	try {
		cout << *iter2;
	} catch (ArrayIteratorException e) {
		cout << e << endl;
	}

	try {
		cout << ++iter2;
	} catch (ArrayIteratorException e) {
		cout << e << endl;
	}

	Array<string> array2(3);

	cout << array2 << endl;

	for (ArrayIterator<string> iter = array2.begin(); iter != array2.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	string a2[] = {"A", "B", "C", "D"};

	array2 = Array<string>(4, a2);

	cout << array2 << endl;

	for (ArrayIterator<string> iter = array2.begin(); iter != array2.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	ArrayIterator<string> iter3 = array2.end();
	try {
		cout << *iter3;
	} catch (ArrayIteratorException e) {
		cout << e << endl;
	}

	try {
		cout << ++iter3;
	} catch (ArrayIteratorException e) {
		cout << e << endl;
	}

	return 0;
}

